package com.scqkxx.gamebox.activity.myself;

import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.v7.widget.LinearLayoutManager;
import android.util.Log;
import android.view.View;

import com.avos.avoscloud.AVException;
import com.avos.avoscloud.AVObject;
import com.avos.avoscloud.AVQuery;
import com.avos.avoscloud.AVUser;
import com.avos.avoscloud.FindCallback;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.scqkxx.gamebox.R;
import com.scqkxx.gamebox.activity.activities.utils.ActivityUtil;
import com.scqkxx.gamebox.activity.activities.view.TitleView;
import com.scqkxx.gamebox.activity.game.adapter.GameAdapter;
import com.scqkxx.gamebox.activity.myself.adapter.MyselfMainListAdapter;
import com.scqkxx.gamebox.activity.myself.adapter.SpaceAdapter;
import com.scqkxx.gamebox.bean.EvenBusBean;
import com.scqkxx.gamebox.databinding.FragmentMyselfBinding;
import com.scqkxx.gamebox.utils.StartActivityUtils;
import com.scqkzqtz.base.base.BaseFragment;
import com.scqkzqtz.base.library.utils.PreferenceUtils;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnRefreshListener;

import org.greenrobot.eventbus.EventBus;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;

/**
 * 我的
 * Created by hef on 2018/8/10.
 */

public class MyselfFragment extends BaseFragment<FragmentMyselfBinding> implements View.OnClickListener, OnRefreshListener {


    @Override
    public void loadData() {
        Log.e("TAG" , "MyselfFragment");
    }

    @Override
    public int setLayoutId() {
        return R.layout.fragment_myself;
    }

    @Override
    public void init() {
        binding.glkj.setOnClickListener(this);
        binding.titleView.getTv_right().setVisibility(View.GONE);
        binding.titleView.setOnTitleClickListener(mTitleType -> {
            if (TitleView.CLICK_BACK == mTitleType) {
                EventBus.getDefault().post(new EvenBusBean(0));
            }
        });
        AVUser avUser = AVUser.getCurrentUser();
        binding.username.setText(avUser.getUsername());
        binding.createTime.setText(new SimpleDateFormat("yyyy年MM月dd日").format(avUser.getCreatedAt()) +"加入nana");
    }

    @Override
    public void setUserVisibleHint(boolean isVisibleToUser) {
        super.setUserVisibleHint(isVisibleToUser);
    }


    @Override
    public void onRefresh(@NonNull RefreshLayout refreshLayout) { }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.glkj:
                ActivityUtil.switchTo(_Activity,MySelfSettingActivity.class);
                break;
        }
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
    }
}
